package com.scalar.chiptrack.operations.packingslip;

import java.util.Comparator;

import com.scalar.chiptrack.sales.LineItem;

/**
 * @author Ravikanth Created on Aug 20, 2003 12:12:52 PM
 * 
 * This class is Used to Compare the POLineItem for Sorting
 * 
 */
public class PackingSlipComparator implements Comparator {

	/* (non-Javadoc)
	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
	 */
	public int compare(Object o1, Object o2) {
		
		if (!(o1 instanceof LineItem) || !(o2 instanceof LineItem))        
		{            
			throw new ClassCastException();        
		}        
		int result = 0;        
		LineItem e1 = (LineItem) o1;        
		LineItem e2 = (LineItem) o2;        
		if (result == 0)
		{
			result = e1.getPoLineItemNo() - e2.getPoLineItemNo();
		}	        
		return result;    
	}

}
